package com.mrart.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mrart.entity.App;
import com.mrart.mysql.mapper.AppMapper;
import com.mrart.service.AppService;

@Service
public class AppServiceImpl implements AppService {
    
    @Autowired
    private AppMapper appMapper;

    /* (non-Javadoc)
     * @see com.mrart.service.impl.AppService#selectByPrimaryKey(java.lang.Long)
     */
    @Override
    public App selectByPrimaryKey(Long id) {
        return appMapper.selectByPrimaryKey(id);
    }
    
    /* (non-Javadoc)
     * @see com.mrart.service.impl.AppService#findAll()
     */
    @Override
    public List<App> findAll() {
        return appMapper.findAll();
    }
    
    /* (non-Javadoc)
     * @see com.mrart.service.impl.AppService#findAppIdByAppKey(java.lang.String)
     */
    @Override
    public Long findAppIdByAppKey(String appKey) {
        List<Long> appIds = appMapper.findAppIdByAppKey(appKey);
        if(appIds!=null && appIds.size()>0) {
            return appIds.get(0);
        } else {
            return null;
        }
    }
}
